home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.FilterInputStream;
- import java.io.IOException;
- import symjava.lang.Bignum;
- import symjava.sql.Date;
- import symjava.sql.SQLException;
- import symjava.sql.Time;
- import symjava.sql.Timestamp;
-
- public class TextParam extends Field {
- // $FF: renamed from: _s symantec.itools.db.net.NetString
- NetString field_0;
-
- public TextParam(int id, String data) {
- super._id = id;
- super._type = 102;
- if (data != null) {
- this.field_0 = new NetString(data);
- } else {
- this.field_0 = new NetString("");
- }
- }
-
- public TextParam() {
- super._id = 0;
- super._type = 102;
- this.field_0 = new NetString("");
- }
-
- int getType() {
- return 58;
- }
-
- void read(DataInputStream in) throws SQLException, IOException, ErrorException {
- in.readShort();
- super._id = ((FilterInputStream)in).read();
- super._type = 102;
- ServerObject obj = (ServerObject)NetClass.getNextObject(in);
- if (obj.getType() == 52) {
- this.field_0 = (NetString)obj;
- } else {
- ((ServerObject)this).onObjectError(obj);
- }
- }
-
- void write(DataOutputStream out) throws IOException {
- out.writeByte(this.getType());
- out.writeShort(1);
- out.writeByte(super._id);
- this.field_0.write(out);
- }
-
- public String getChar() throws SQLException {
- return new String(this.field_0.getString());
- }
-
- public String getVarChar() throws SQLException {
- return new String(this.field_0.getString());
- }
-
- public String getLongVarChar() throws SQLException {
- return new String(this.field_0.getString());
- }
-
- public boolean getBit() throws SQLException {
- byte b = (byte)this.field_0.getString().charAt(0);
- return b != 0;
- }
-
- public byte getTinyInt() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return (byte)d.intValue();
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public short getSmallInt() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return (short)d.intValue();
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public int getInteger() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return d.intValue();
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public long getBigInt() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return d.longValue();
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public float getReal() throws SQLException {
- return this.getFloat();
- }
-
- public float getFloat() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return d.floatValue();
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public double getDouble() throws SQLException {
- try {
- Double d = new Double(this.field_0.getString());
- return d;
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public Bignum getBignum(int scale) throws SQLException {
- return new Bignum(this.field_0.getString(), scale);
- }
-
- public Bignum getDecimal(int scale) throws SQLException {
- return new Bignum(this.field_0.getString(), scale);
- }
-
- public byte[] getBinary() throws SQLException {
- try {
- String s = this.field_0.getString();
- byte[] dst = new byte[s.length()];
- s.getBytes(0, s.length() - 1, dst, 0);
- return dst;
- } catch (Exception e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- }
-
- public byte[] getVarBinary() throws SQLException {
- return this.getBinary();
- }
-
- public byte[] getLongVarBinary() throws SQLException {
- return this.getBinary();
- }
-
- public Date getDate() throws SQLException {
- return Date.valueOf(this.field_0.getString());
- }
-
- public Time getTime() throws SQLException {
- return Time.valueOf(this.field_0.getString());
- }
-
- public Timestamp getTimestamp() throws SQLException {
- return Timestamp.valueOf(this.field_0.getString());
- }
- }
-